import 'package:flutter/material.dart';

/** 头像标题布局
 * ListView.builder
 * ListTile
 */
class ListWidget04 extends StatelessWidget {
  const ListWidget04({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xffff0000),
        title: Text('ListView.build'),
      ),
      body: GestureDetector(
        child: ListView.builder(
          ///item设置
          itemBuilder: (BuildContext context, int index) {
            return const ListTile(
              leading: CircleAvatar(
                backgroundImage: AssetImage('images/s227.png'),
              ),
              title: Text('科比'),
              subtitle: Text('喜欢的篮球明星'),
              trailing: Text('详情'),
            );
          },
          itemCount: 20,
        ),
        onTap: (){
          print('点击了item');
        },
      ),
    );
  }
}
